# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py3-sqlalchemy-migrate
_pkgname=sqlalchemy-migrate
pkgver=0.13.0
pkgrel=6
pkgdesc="SQLAlchemy Schema Migration Tools"
url="https://opendev.org/x/sqlalchemy-migrate"
arch="noarch"
license="MIT"
depends="
	py3-pbr
	py3-sqlalchemy
	py3-decorator
	py3-setuptools
	py3-six
	py3-sqlparse
	py3-tempita
	"
makedepends="
	py3-gpep517
	py3-pbr
	py3-wheel
	"
checkdepends="
	py3-mock
	py3-pytest
	py3-scripttest
	py3-testtools
	"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/s/$_pkgname/$_pkgname-$pkgver.tar.gz
	versionspec.patch
	"
builddir="$srcdir/$_pkgname-$pkgver"
options="!check" # missing ibm_db_sa

replaces=py-sqlalchemy-migrate # Backwards compatibility
provides=py-sqlalchemy-migrate=$pkgver-r$pkgrel # Backwards compatibility

export PBR_VERSION="$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
	rm -rf "$pkgdir"/usr/lib/python*/site-packages/migrate/tests
}

sha512sums="
1ca826a5d80c1373ffc4b2366dfb6d5dd24204964462873451c97d8ff4d75fc6c63f663c4769b7f6cc00002f6a98d425f41d759e5c010b4b81a8b74ffbb102b6  sqlalchemy-migrate-0.13.0.tar.gz
f65e32952ec526000b9816a10c827d15d466ee1c1d5773f1466823a8ec6c15297b53192a3d8eca9758a0a9a4069e2878c595084dab8eaa3a0aaf68e50ae1bc49  versionspec.patch
"
